package com.weixing.mall.leaf.api.hystrix;

import com.weixing.mall.leaf.api.service.IdGenServiceRpc;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class LogFallbackFactory implements FallbackFactory<IdGenServiceRpc> {
    @Override
    public IdGenServiceRpc create(final Throwable throwable) {

        return new IdGenServiceRpc() {
            @Override
            public long segmentKey(String key) {
                log.info("query log fallback reason was:",throwable);
                return 0;
            }

            @Override
            public long snowFlakeKey(String key) {
                log.info("query log fallback reason was:",throwable);
                return 0;
            }

        };
    }
}